package cn.flying.system.web.cm;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.flying.base.common.vo.PageRequest;
import cn.flying.base.common.vo.PageResponse;
import cn.flying.system.domain.cm.CmLoginLog;
import cn.flying.system.domain.cm.CmOperLog;
import cn.flying.system.domain.cm.CmOperLogWithBLOBs;
import cn.flying.system.service.cm.CmLoginLogService;
import cn.flying.system.service.cm.CmOperLogService;

/**
 * @description: 登录操作日志
 * @author: lvyong
 * @date: 2023年05月31日 13:39
 * @version: 1.0
 */
@Controller
public class CmLoginLogController {

    @Resource
    private CmLoginLogService cmLoginLogService;
    @Resource
    private CmOperLogService cmOperLogService;

    /**
     * 登录日志列表页面
     *
     * @return
     */
    @RequestMapping("loginLog/list")
    public String loginLogList(Model model) {
        return "sys/log/login/list";
    }

    /**
     * 登录日志列表数据
     *
     * @param pageRequest
     * @return
     */
    @PostMapping(value = "loginLog/getLoginLogPageList")
    @ResponseBody
    public PageResponse<CmLoginLog> getLoginLogPageList(PageRequest<CmLoginLog> pageRequest) {
        PageResponse<CmLoginLog> pageResponse = cmLoginLogService.getLoginLogPageList(pageRequest);
        return pageResponse;
    }

    /**
     * 操作志列表页面
     *
     * @return
     */
    @RequestMapping("operLog/list")
    public String operLogList(Model model) {
        return "sys/log/oper/list";
    }

    /**
     * 操作日志列表数据
     *
     * @param pageRequest
     * @return
     */
    @PostMapping(value = "operLog/getOperLogPageList")
    @ResponseBody
    public PageResponse<CmOperLogWithBLOBs> getOperLogPageList(PageRequest<CmOperLog> pageRequest) {
        PageResponse<CmOperLogWithBLOBs> pageResponse = cmOperLogService.getOperLogPageList(pageRequest);
        return pageResponse;
    }

}
